package castle_components
{
	import flash.display.MovieClip;
	import units.Unit;
	import units.Orange_Unit;
	
	public class Orange_Primary_Trainer extends Training_Building
	{
		public var training_limit = 20;
		
		public function Orange_Primary_Trainer()
		{
			super();
		}
		
		public function unit_action(u:Unit){
			u.gain_experience();

			if(u.unit_type == "base_unit" && u.training_exp >= training_limit){
				var u_x = u.x;
				var u_y = u.y;
				
				u.die();
				
				var new_unit = new Orange_Unit(this.game_handler,this.castle);
				new_unit.x = u_x;
				new_unit.y = u_y;
				
			}
		}
	}
}